<div class="detail">
	<?php
		require_once('lib/sql.utils.php');
		require_once('lib/same_book.php');
		$sql_utils = new SqlUtils();
		$bookId = $_GET['bookId'];
		$result = $sql_utils->getRows('SELECT * FROM books
										JOIN categoryDetails ON books.categoryDetailId = categorydetails.categoryDetailId
										JOIN categories ON categories.categoryId = categorydetails.categoryId
										JOIN authors ON books.authorId = authors.authorId
										JOIN publishers ON books.publisherId = publishers.publisherId
										JOIN bookstores ON books.bookStoreId = bookstores.bookStoreId
										WHERE bookId = '.$bookId);
		echo '<div class="name">'.$result[0]['bookName'].'</div>';
		echo '<div class="image">';
			echo '<img src="images/book/'.$result[0]['bookImage'].'" />';
		echo '</div>';
		echo '<div class="info">';
			echo 'Tác giả : '.'<a onclick="getAuthor('.$result[0]['authorId'].')">'.$result[0]['authorName'].'</a><br />';
			echo 'Tủ sách : '.'<a onclick="getCategoryDetail('.$result[0]['categoryDetailId'].')">'.$result[0]['categoryDetailName'].'</a><br />';
			echo 'Danh mục : '.'<a onclick="getCategory('.$result[0]['categoryId'].')">'.$result[0]['categoryName'].'</a><br />';
			echo 'Đánh giá : '.'<br />';
			echo 'Cỡ sách : '.$result[0]['bookSize'].'<br />';
			echo 'Giá bán : '.$result[0]['bookPrice'].',000 đồng'.'<br />';
			echo 'Giá sách cũ : '.$result[0]['bookDiscount'].',000 đồng'.'<br />';
			echo 'Nhà xuất bản : '.'<a onclick="getPublisher('.$result[0]['publisherId'].')">'.$result[0]['publisherName'].'</a><br />';
			echo 'Ngày xuất bản : '.$result[0]['bookDatePublish'].'</a><br />';
			echo 'Có tại : hiệu sách '.'<a onclick="getBookStore('.$result[0]['bookStoreId'].')">'.$result[0]['bookStoreName'].'</a><br />';
		echo '</div>';
		echo '<div class="description">';
			echo $result[0]['bookDescription'];
		echo '</div>';
		echo '<input class="add-cart" type="button"  id="addToCart" onclick="addCart('.$bookId.')"/>';
		echo '<button class="back-btn" onclick="prevContent()"></button>';
		
		$sameBook = new sameBook('SELECT * FROM books WHERE categoryDetailId = '.$result[0]['categoryDetailId'],
								'Các sách cùng tủ sách :','same-book');
		$sameBook->display();
	?>
</div>